home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / p_man / cat3 / f90 / set_ieee_rounding_mode.z / set_ieee_rounding_mode
Text File  |  1998-10-30  |  4KB  |  106 lines

  1. SET_IEEE_ROUNDING_MODE(3I)                             Last changed: 1-6-98
  2.  
  3.  
  4. NNAAMMEE
  5.      SSEETT__IIEEEEEE__RROOUUNNDDIINNGG__MMOODDEE - Alters current floating-point rounding mode
  6.      state and restores the floating-point rounding mode before exiting a
  7.      procedure
  8.  
  9. SSYYNNOOPPSSIISS
  10.      SSEETT__IIEEEEEE__RROOUUNNDDIINNGG__MMOODDEE (([RROOUUNNDDIINNGG__MMOODDEE==]_r_o_u_n_d_i_n_g__m_o_d_e))
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      UNICOS/mk and IRIX systems
  14.  
  15.      CRAY T90 systems that support IEEE arithmetic
  16.  
  17. SSTTAANNDDAARRDDSS
  18.      CF90 and MIPSpro 7 Fortran 90 compiler extension to Fortran 90
  19.  
  20.      IEEE Standard for Binary Floating-point Arithmetic
  21.  
  22. DDEESSCCRRIIPPTTIIOONN
  23.      The SSEETT__IIEEEEEE__RROOUUNNDDIINNGG__MMOODDEE intrinsic subroutine is typically used to
  24.      alter the current floating-point rounding mode state and to restore
  25.      the caller's floating-point rounding mode just before exiting a
  26.      procedure.  It accepts the following argument:
  27.  
  28.      _r_o_u_n_d_i_n_g__m_o_d_e
  29.                Must be scalar and of an integer type that occupies a full
  30.                word.  It is an IINNTTEENNTT((IINN)) argument.
  31.  
  32.                The floating-point rounding mode is set to the rounding mode
  33.                indicated by _r_o_u_n_d_i_n_g__m_o_d_e.
  34.  
  35.                _r_o_u_n_d_i_n_g__m_o_d_e must have one of the values represented by the
  36.                following named constants:
  37.  
  38.                * IIEEEEEE__RRMM__NNEEAARREESSTT
  39.  
  40.                * IIEEEEEE__RRMM__PPOOSS__IINNFFIINNIITTYY
  41.  
  42.                * IIEEEEEE__RRMM__ZZEERROO
  43.  
  44.                * IIEEEEEE__RRMM__NNEEGG__IINNFFIINNIITTYY
  45.  
  46.                _r_o_u_n_d_i_n_g__m_o_d_e is assumed to have been set through an
  47.                invocation of GGEETT__IIEEEEEE__RROOUUNNDDIINNGG__MMOODDEE(3I).
  48.  
  49.      The IIEEEEEE__RREEAALL(3I) and IIEEEEEE__IINNTT(3I) functions are the only routines
  50.      supplied by Cray Research that examine the setting of the rounding
  51.      mode on CRAY T90 systems that support IEEE arithmetic, UNICOS/mk
  52.      systems, and IRIX systems.
  53.  
  54.      The name of this intrinsic cannot be passed as an argument.
  55.  
  56. NNOOTTEESS
  57.      The IEEE intrinsic procedures use the named constants contained in a
  58.      system module, so you must include one of the following statements in
  59.      your program:
  60.  
  61.      * On UNICOS and UNICOS/mk systems:  UUSSEE CCRRII__IIEEEEEE__DDEEFFIINNIITTIIOONNSS
  62.  
  63.      * On UNICOS, UNICOS/mk, and IRIX systems:  UUSSEE FFTTNN__IIEEEEEE__DDEEFFIINNIITTIIOONNSS
  64.  
  65.      The CCRRII__IIEEEEEE__DDEEFFIINNIITTIIOONNSS module is obsolescent.  It will be removed
  66.      for the CF90 4.0 release.
  67.  
  68. EEXXAAMMPPLLEESS
  69.         ! Assume the following code is executing on a machine where default
  70.         ! integer occupies a full word.
  71.  
  72.         INTEGER  save_rounding_mode
  73.  
  74.         ! Save the current rounding mode then change the rounding mode
  75.         ! to round to positive infinity.
  76.  
  77.         CALL GET_IEEE_ROUNDING_MODE(save_rounding_mode)
  78.         CALL SET_IEEE_ROUNDING_MODE(IEEE_RM_POS_INFINITY)
  79.  
  80.         ! Calculate the upper bound on sum.
  81.  
  82.         DO i = 1, n
  83.            xup(i)  = y(i) + z(i)
  84.         END DO
  85.  
  86.         ! Reset to round to negative infinity mode.
  87.  
  88.         CALL SET_IEEE_ROUNDING_MODE(IEEE_RM_NEG_INFINITY)
  89.  
  90.         ! Calculate lower bound on sum.
  91.  
  92.         DO i = 1, n
  93.            xdn(i) = y(i) + z(i)
  94.         END DO
  95.  
  96.         ! Restore original rounding mode and return to the caller.
  97.  
  98.         CALL SET_IEEE_ROUNDING_MODE(save_rounding_mode)
  99.  
  100. SSEEEE AALLSSOO
  101.      GGEETT__IIEEEEEE__RROOUUNNDDIINNGG__MMOODDEE(3I)
  102.  
  103.      _I_n_t_r_i_n_s_i_c _P_r_o_c_e_d_u_r_e_s _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, publication SR-2138, for the
  104.      printed version of this man page.
  105.  
  106.